package test;

import java.util.Scanner;

public class Student {
	private String name;
	private int score;
	
	@Override
	public String toString() {
		return "Student [name=" + name + ", score=" + score + "]";
	}

	public String getName() {
		return name;
	}

	public void setName(String name) throws IllegalNameException {
		if(name.charAt(0) < 57 && name.charAt(0) > 48)
			throw new IllegalNameException("the first char of name must not be digit, name="+name);
		this.name = name;
	}

	public int getScore() {
		return score;
	}

	public void setScore(int score) throws IllegalArgumentException {
		this.score = score;
	}

	public int addScore(int score)  throws IllegalScoreException {
		if(score>100 ||score<0)
		{
			throw new IllegalScoreException("score out of range, score="+score);
		}this.score=score;
		return score;		
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in) ;
       while(sc.hasNext()){
    	   String a = sc.next();
    	   if(a.equals("new"))
    	   {
    		   Student stu = new Student(); 
    	   String b = sc.nextLine();
    	   try{
    	   stu.setName(sc.next(b));}catch(IllegalNameException e1){
    		   System.out.println(e1);
    	   }
    	   try {
			stu.addScore(sc.nextInt());
		} catch (IllegalScoreException e) {
			System.out.println(e);
		}
    	   System.out.println(stu.toString());
       }
    	   else{
    		   break;
    	   }
    	   
	}
 }
}
//finally{
//    		   sc.close();
//    		   System.out.println("scanner closed");
//    	   }
//}